package com.example.dmdomain;

import com.example.dmdomain.entity.ChatContext;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ChatContextRepository extends JpaRepository<ChatContext, String>, JpaSpecificationExecutor<ChatContext> {
    @Query(value = "select * from chat_context where session_id= :sessionId order by session_time", nativeQuery = true)
    List<ChatContext> findAllBySessionId(@Param("sessionId") String sessionId);
}
